<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://cdn.staticfile.org/jquery/1.11.3/jquery.min.js"></script>
    <title>子应用2</title>
  </head>
  <body>
    <div>子应用2</div>
    <input type="text" id="content" value="222" />
    <button id="callParentHandle">和父级主应用通信</button>
    <hr />
    页面2 接收的内容：
    <p id="result"></p>
    <script>
      if (window.$wujie) {
        const wujie = window.$wujie
        console.log(wujie)
        $('#callParentHandle').on('click', function () {
          wujie.bus.$emit('setPublicData', {
            data: $('#content').val()
          })
        })

        // 监听父级主应用时间
        wujie.bus.$on('commonHandle', function (e) {
          console.log(e, '-->>> e')
          $('#result').text(JSON.stringify(e))
        })
      }
    </script>
  </body>
</html>
